package web.suzy.oj.config;

import com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor;
import com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor;
import org.mybatis.spring.annotation.MapperScan;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.transaction.annotation.EnableTransactionManagement;

/**
 * YangSuzy 软件工作室
 * 类名: MybatisPlusConfig
 * 描述: MybatisPlus配置类
 * 功能: ---- 待定 -----
 *
 * @author YangSuzy
 * Date: 2022/11/9 14:49
 */
@Configuration
@EnableTransactionManagement
@MapperScan("web.suzy.oj.mapper")
public class MybatisPlusConfig {

    /**
     * 方法名: optimisticLockerInterceptor
     * 描述: 注册乐观锁插件
     *
     * @return com.baomidou.mybatisplus.extension.plugins.OptimisticLockerInterceptor
     * @date 2022/11/13 21:45
     * @auther YangSuzy
     **/
    @Bean
    public OptimisticLockerInterceptor optimisticLockerInterceptor() {
        return new OptimisticLockerInterceptor();
    }

    /**
     * 方法名: paginationInterceptor
     * 描述: 分页插件
     *
     * @return com.baomidou.mybatisplus.extension.plugins.PaginationInterceptor
     * @date 2022/11/9 14:50
     * @auther YangSuzy
     **/
    @Bean
    public PaginationInterceptor paginationInterceptor() {
        return new PaginationInterceptor();
    }
}
